package com.atguigu.springboot.mapper;

import com.atguigu.springboot.bean.Department;
import org.apache.ibatis.annotations.*;

public interface DepartmentMapper {

    @Select("SELECT id,departmentName FROM department WHERE id=#{id}")
    public Department getDeptById(Integer id) ;

    @Delete("DELETE FROM department WHERE id=#{id}")
    public int deleteDeptById(Integer id) ;

    @Options(useGeneratedKeys = true , keyProperty = "id")
    @Insert("INSERT INTO department(departmentName) VALUES(#{departmentName})")
    public int insertDept(Department department) ;

    @Update("UPDATE department SET departmentName=#{departmentName} WHERE id=#{id}")
    public int updateDept(Department department) ;

}
